/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Administrator
 * Date: 2023-07-23
 * Time: 23:38
 */
public class Test7 {
    public static boolean isQuit = false;
    public static void main(String[] args) throws InterruptedException {
        Thread t = new Thread(() ->{
           while (!isQuit){
               System.out.println("hello thread");
               try {
                   Thread.sleep(3000);
               } catch (InterruptedException e) {
                   e.printStackTrace();
               }
           }
        });
        t.start();

        Thread.sleep(3000);

        isQuit = true;
        System.out.println("t线程结束");
    }
}
